{ "metadata": { "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.5-final" }, "orig_nbformat": 2, "kernelspec": { "name": "python3", "display_name": "Python 3", "language": "python" } }, "nbformat": 4, "nbformat_minor": 2, "cells": [ { "source": [ "# Uber Trips" ], "cell_type": "markdown", "metadata": {} }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", "\n", "from hotstepper import Steps\n", "\n", "import warnings\n", "warnings.filterwarnings(\"ignore\")" ] }, { "source": [ "Read the data from a csv into a dataframe so we can have a quick look at what we have." ], "cell_type": "markdown", "metadata": {} }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ " VendorID tpep_pickup_datetime tpep_dropoff_datetime \\\n", "0 2 2015-01-15 19:05:39+00:00 2015-01-15 19:23:42+00:00 \n", "1 2 2015-01-15 19:05:39+00:00 2015-01-15 19:32:00+00:00 \n", "2 2 2015-01-15 19:05:40+00:00 2015-01-15 19:21:00+00:00 \n", "3 2 2015-01-15 19:05:40+00:00 2015-01-15 19:28:18+00:00 \n", "4 2 2015-01-15 19:05:41+00:00 2015-01-15 19:20:36+00:00 \n", "\n", " passenger_count trip_distance pickup_longitude pickup_latitude \\\n", "0 1 1.59 -73.993896 40.750111 \n", "1 1 2.38 -73.976425 40.739811 \n", "2 5 2.83 -73.968704 40.754246 \n", "3 5 8.33 -73.863060 40.769581 \n", "4 1 2.37 -73.945541 40.779423 \n", "\n", " dropoff_longitude dropoff_latitude fare_amount tip_amount total_amount \n", "0 -73.974785 40.750618 12.0 3.25 17.05 \n", "1 -73.983978 40.757889 16.5 4.38 22.68 \n", "2 -73.955124 40.786858 12.5 0.00 14.30 \n", "3 -73.952713 40.785782 26.0 8.08 41.21 \n", "4 -73.980850 40.786083 11.5 0.00 13.30 " ], "text/html": "
| \n | VendorID | \ntpep_pickup_datetime | \ntpep_dropoff_datetime | \npassenger_count | \ntrip_distance | \npickup_longitude | \npickup_latitude | \ndropoff_longitude | \ndropoff_latitude | \nfare_amount | \ntip_amount | \ntotal_amount | \n
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n2 | \n2015-01-15 19:05:39+00:00 | \n2015-01-15 19:23:42+00:00 | \n1 | \n1.59 | \n-73.993896 | \n40.750111 | \n-73.974785 | \n40.750618 | \n12.0 | \n3.25 | \n17.05 | \n
| 1 | \n2 | \n2015-01-15 19:05:39+00:00 | \n2015-01-15 19:32:00+00:00 | \n1 | \n2.38 | \n-73.976425 | \n40.739811 | \n-73.983978 | \n40.757889 | \n16.5 | \n4.38 | \n22.68 | \n
| 2 | \n2 | \n2015-01-15 19:05:40+00:00 | \n2015-01-15 19:21:00+00:00 | \n5 | \n2.83 | \n-73.968704 | \n40.754246 | \n-73.955124 | \n40.786858 | \n12.5 | \n0.00 | \n14.30 | \n
| 3 | \n2 | \n2015-01-15 19:05:40+00:00 | \n2015-01-15 19:28:18+00:00 | \n5 | \n8.33 | \n-73.863060 | \n40.769581 | \n-73.952713 | \n40.785782 | \n26.0 | \n8.08 | \n41.21 | \n
| 4 | \n2 | \n2015-01-15 19:05:41+00:00 | \n2015-01-15 19:20:36+00:00 | \n1 | \n2.37 | \n-73.945541 | \n40.779423 | \n-73.980850 | \n40.786083 | \n11.5 | \n0.00 | \n13.30 | \n